﻿<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="EditReview.aspx.cs" Inherits="CodeDemon.Views.Review.EditReview" %>

<h3>Edit Review Details</h3>

<form action="/CodeDemon/Review/UpdateReviewDetails" method="post" id="htmlForm">
<% 			var review = (from reviews in ViewData.Model.DAO.GetReviewsById(ViewData.Model.CurrentReviewID) select reviews).FirstOrDefault(); %>

    <div>
    <label for="Title"><span>Title:</span><input name="Title" value="<%=review.Title %>" /></label>
    </div>
    
    <div>
    <label for="Description"><span>Description:</span><textarea name="Description" rows="10" cols="50"><%=review.Description%></textarea></label>
    </div>
    <div>
        <input type="submit" name="Submit" value="Save Changes" />
        <input value="Cancel" name="Cancel" type="button" class="jqmClose" />
    </div>

<%= Html.Hidden("ReviewId", ViewData.Model.CurrentReviewID.ToString())%>
</p>

<div id="results">
    Review Updated.
</div>

<script type="text/javascript">
// prepare the form when the DOM is ready 
$(document).ready(function() { 
    $('#results').hide();
    // bind form using ajaxForm 
    $('#htmlForm').ajaxForm({ 
        // target identifies the element(s) to update with the server response 
        target: '#results', 
 
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() { 
            $('#results').show('1'); 
            //TODO : WTF?
            getComments('<%=ViewData.Model.CurrentReviewID %>');
            $('#ex3').jqmHide();
        } 
    }); 
});
</script>

</form>
